package edu.zut.cs.network.Experiment4;
import javax.swing.JOptionPane;
public class PrintMatrix {
    public static void printMatrix(int n){
        int [][] ma = new int [n][n];
        for(int i = 0; i < n;i++) {
            for (int j = 0; j < n; j++) {
                System.out.print("1  ");
            }
            System.out.println();
        }
    }
    public static void main(String[] args) {
//        输出一个所有元素为1的n行n列矩阵
        String str = JOptionPane.showInputDialog("请输入n阶矩阵的阶数n的值：");
        int n = Integer.parseInt(str);
        PrintMatrix.printMatrix(n);
    }
}
